package pers.qianyu.month_202012.date_20201229;

/**
 * 263. 丑数
 * https://leetcode-cn.com/problems/ugly-number/
 *
 * @author mizzle rain
 * @date 2020-12-29 21:20
 */
public class IsUgly {
    public boolean isUgly(int num) {
        if (num == 0) return false;
        int[] primes = {2, 3, 5};
        for (int prime : primes) {
            while (num % prime == 0) {
                num /= prime;
            }
        }
        return num == 1;
    }
}
